package pl.piomin.services.auth;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
@Order(-10)
public class SecurityConfig extends WebSecurityConfigurerAdapter {

	// @Autowired
	// private DataSource dataSource;

	@Override
	protected void configure(HttpSecurity http) throws Exception {
//		http.sessionManagement().
//		http.authorizeRequests().antMatchers("/**").permitAll();
		http.authorizeRequests().anyRequest().authenticated();
//		and().formLogin().loginPage("/login").permitAll().and().httpBasic().disable();
	}

	// @Override
	// public void configure(AuthenticationManagerBuilder auth) throws Exception
	// {
	// auth.jdbcAuthentication().dataSource(dataSource);
	// auth.inMemoryAuthentication().withUser("root").password("password").roles("USER");
	// }

}
